<?php
$edit = $this->nbscache->get_explode("menu", $this->session->userdata("id_privilege"));
$menu_ca = unserialize($edit[1]);
//$this->debug($edit,true);
//print "<pre>";
//print_r();die;
//$menu = array(
//    array(
//        "name"    => "Settings", 
//        "child"   =>
//          array(
//              array(
//                  "name"    =>  "Users",
//                  "link"    =>  "users"
//              ),
//              array(
//                  "name"    =>  "Menu",
//                  "link"    =>  "menu"
//              ),
//              array(
//                  "name"    =>  "Outlet",
//                  "link"    =>  "outlet"
//              ),
//          )
//    ),
//    array(
//        "name"    => "Outlet", 
//        "child"   => 
//          array(
//            array(
//                "name"    =>  "Daftar Laporan",
//                "link"    =>  "outlet/aktifitas/daftar"
//            ),
//            array(
//                "name"    =>  "Daftar Outlet",
//                "link"    =>  "outlet/milik"
//            ),
//          )
//    ),
//);
//print '<pre>';
////print_r($menu);die;
//print_r(serialize($menu));die;
?>
<!DOCTYPE HTML>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Mr. Montir - Bisnis Monitoring</title>
<!-- styles -->
<link href="<?=$url?>css/bootstrap.css" rel="stylesheet">
<link href="<?=$url?>css/jquery-ui-1.8.16.custom.css" rel="stylesheet">
<link href="<?=$url?>css/jquery.jqplot.css" rel="stylesheet">
<link href="<?=$url?>css/prettify.css" rel="stylesheet">
<link href="<?=$url?>css/elfinder.min.css" rel="stylesheet">
<link href="<?=$url?>css/elfinder.theme.css" rel="stylesheet">
<link href="<?=$url?>css/fullcalendar.css" rel="stylesheet">
<link href="<?=$url?>js/plupupload/jquery.plupload.queue/css/jquery.plupload.queue.css" rel="stylesheet">
<link href="<?=$url?>css/styles.css" rel="stylesheet">
<link href="<?=$url?>css/bootstrap-responsive.css" rel="stylesheet">
<link href="<?=$url?>css/icons-sprite.css" rel="stylesheet">
<link id="themes" href="<?=$url?>css/themes.css" rel="stylesheet">
<!--[if IE 7]>
<link rel="stylesheet" type="text/css" href="css/ie/ie7.css" />
<![endif]-->
<!--[if IE 8]>
<link rel="stylesheet" type="text/css" href="css/ie/ie8.css" />
<![endif]-->
<!--[if IE 9]>
<link rel="stylesheet" type="text/css" href="css/ie/ie9.css" />
<![endif]-->
<!--fav and touch icons -->
<link rel="shortcut icon" href="<?=$url?>ico/mrmontir.ico">
<link rel="apple-touch-icon-precomposed" sizes="144x144" href="<?=$url?>ico/apple-touch-icon-144-precomposed.png">
<link rel="apple-touch-icon-precomposed" sizes="114x114" href="<?=$url?>ico/apple-touch-icon-114-precomposed.png">
<link rel="apple-touch-icon-precomposed" sizes="72x72" href="<?=$url?>ico/apple-touch-icon-72-precomposed.png">
<link rel="apple-touch-icon-precomposed" href="<?=$url?>ico/apple-touch-icon-57-precomposed.png">
<link href="<?=$url?>css/simpletree.css" rel="stylesheet">
<script type="text/javascript" charset="utf-8" src="<?=$url?>js/simpletreemenu.js"></script>
<script src="<?=$url?>js/jquery.js"></script>
<script src="<?=$url?>js/jquery-ui-1.8.16.custom.min.js"></script>
<script src="<?=$url?>js/jquery.ui.touch-punch.js"></script>
<script src="<?=$url?>js/bootstrap.js"></script>
<script src="<?=$url?>js/prettify.js"></script>
<script src="<?=$url?>js/jquery.sparkline.min.js"></script>
<script src="<?=$url?>js/jquery.nicescroll.min.js"></script>
<script src="<?=$url?>js/accordion.jquery.js"></script>
<script src="<?=$url?>js/smart-wizard.jquery.js"></script>
<script src="<?=$url?>js/vaidation.jquery.js"></script>
<script src="<?=$url?>js/jquery-dynamic-form.js"></script>
<script src="<?=$url?>js/fullcalendar.js"></script>
<script src="<?=$url?>js/raty.jquery.js"></script>
<script src="<?=$url?>js/jquery.noty.js"></script>
<script src="<?=$url?>js/jquery.cleditor.min.js"></script>
<script src="<?=$url?>js/data-table.jquery.js"></script>
<script src="<?=$url?>js/TableTools.min.js"></script>
<script src="<?=$url?>js/ColVis.min.js"></script>
<script src="<?=$url?>js/plupload.full.js"></script>
<script src="<?=$url?>js/elfinder/elfinder.min.js"></script>
<script src="<?=$url?>js/chosen.jquery.js"></script>
<script src="<?=$url?>js/uniform.jquery.js"></script>
<script src="<?=$url?>js/jquery.tagsinput.js"></script>
<script src="<?=$url?>js/jquery.colorbox-min.js"></script>
<script src="<?=$url?>js/check-all.jquery.js"></script>
<script src="<?=$url?>js/inputmask.jquery.js"></script>
<!--<script src="http://bp.yahooapis.com/2.4.21/browserplus-min.js"></script>-->
<script src="<?=$url?>js/plupupload/jquery.plupload.queue/jquery.plupload.queue.js"></script>
<script src="<?=$url?>js/excanvas.min.js"></script>
<script src="<?=$url?>js/jquery.jqplot.min.js"></script>
<script src="<?=$url?>js/chart/jqplot.highlighter.min.js"></script>
<script src="<?=$url?>js/chart/jqplot.cursor.min.js"></script>
<script src="<?=$url?>js/chart/jqplot.dateAxisRenderer.min.js"></script>
<script src="<?=$url?>js/chart/jqplot.pieRenderer.min.js"></script>
<script src="<?=$url?>js/custom-script.js"></script>

<script src="<?=$url?>js/jquery.table.addrow.js"></script>
<script src="<?=$url?>js/jquery.jeditable.js"></script>
<script src="<?=$url?>js/jquery.ui.core.js"></script>
<script src="<?=$url?>js/jquery.ui.widget.js"></script>
<script src="<?=$url?>js/jquery.ui.position.js"></script>
<!--<script src="<?=$url?>js/jquery.ui.menu.js"></script>-->
<script src="<?=$url?>js/jquery.ui.autocomplete.js"></script>
<script src="<?=$url?>js/jquery.ui.datepicker.js"></script>
<!-- html5.js for IE less than 9 -->
<!--[if lt IE 9]>
	<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
</head>
<?php
//$site_juklak = site_jump("POS", "klik_pos", "http://localhost/newmontir/mrmontir/index.php", $this->session->userdata('ename'), $this->session->userdata('epass'));
//print $site_juklak['script'];
?>
<body>
<div class="navbar navbar-fixed-top">
  <div class="navbar-inner top-nav">
    <div class="container-fluid">
<!--      <div class="branding">
        <div class="logo">  </div>
      </div>-->
      <ul class="nav pull-right">
        <li class="dropdown"><a data-toggle="dropdown" class="dropdown-toggle" href="#"><?=$this->session->userdata('name')?><i class="white-icons admin_user"></i><b class="caret"></b></a>
          <ul class="dropdown-menu">
            <!--<li><?=$site_juklak['link']?></li>-->
            <li><a href="<?=site_url("users/edit-profile")?>"><i class="icon-cog"></i> Account Settings</a></li>
            <li class="divider"></li>
            <li><a href="<?=  site_url("login")?>"><i class="icon-off"></i><strong> Logout</strong></a></li>
          </ul>
        </li>
      </ul>
      <button data-target=".nav-collapse" data-toggle="collapse" class="btn btn-navbar" type="button"><span class="icon-bar"></span><span class="icon-bar"></span><span class="icon-bar"></span></button>
      <div class="nav-collapse collapse">
        <ul class="nav">
          <?php
          foreach($menu_drop as $md){
            if($md){
            ?>
          <li class="dropdown"><a href="#" class="dropdown-toggle" data-toggle="dropdown"><i class="nav-icon blocks_images"></i><?=$md[0]->kategori?><b class="caret"></b></a>
            <ul class="dropdown-menu">
              <?php
              if(is_array($md)){
                foreach($md as $mns2){
                  $link_set = site_url($mns2->link);
                  print <<<EOD
       <li class="nav-header"><a href="{$link_set}"><span class="sidenav-icon"><span class="sidenav-link-color"></span></span>$mns2->name</a></li>
EOD;
                }
              }
              ?>
            </ul>
          </li>
          <?php
            }
          }?>
        </ul>
      </div>
    </div>
  </div>
</div>
<div id="sidebar">
  <center><a href=""><img src="<?=$url?>img/logo.png" width="168" height="40" alt="Logo"></a></center>
<!--  <ul id="treemenu2" class="treeview side-nav">
    <li><div class="lili"><span class="white-icons blocks_images"></span>Sub Item 1.1.2</div>
      <ul class="acitem">
        <li><div class="sublili"><span class="white-icons list"></span>Sub Test2</div>
          <ul rel="open">
            <li><div class="subsublili"><span class="white-icons book"></span><a href="ad">Sub Item 1.1.1</a></div></li>
            <li><div class="subsublili"><span class="white-icons book"></span>Sub Item 1.1.2</div></li>
            <li><div class="subsublili"><span class="white-icons book"></span>Folder 1.1.1</div>
              <ul>
                <li><div class="subsubsublili"><span class="white-icons note_book"></span>Sub item 1.1.1.1</div></li>
                <li><div class="subsubsublili"><span class="white-icons note_book"></span>Sub item 1.1.1.2</div></li>
                <li><div class="subsubsublili"><span class="white-icons note_book"></span>Sub item 1.1.1.3</div></li>
                <li><div class="subsubsublili"><span class="white-icons note_book"></span>Sub item 1.1.1.4</div></li>
              </ul>
            </li>
          </ul>
        </li>
        <li><div class="sublili"><span class="white-icons list"></span>Sub Test2</div>
          <ul>
            <li><div class="subsublili"><span class="white-icons book"></span><a href="ad">Sub Item 1.1.1</a></div></li>
            <li><div class="subsublili"><span class="white-icons book"></span>Sub Item 1.1.2</div></li>
            <li><div class="subsublili"><span class="white-icons book"></span>Folder 1.1.1</div>
              <ul>
                <li><div class="subsubsublili"><span class="white-icons note_book"></span>Sub item 1.1.1.1</div></li>
                <li><div class="subsubsublili"><span class="white-icons note_book"></span>Sub item 1.1.1.2</div></li>
                <li><div class="subsubsublili"><span class="white-icons note_book"></span>Sub item 1.1.1.3</div></li>
                <li><div class="subsubsublili"><span class="white-icons note_book"></span>Sub item 1.1.1.4</div></li>
              </ul>
            </li>
          </ul>
        </li>
      </ul>
    </li>
  </ul>-->
  <ul id="treemenu2" class="treeview side-nav">
    <?php
    foreach($menu_ca as $k_mc => $mc){
      print <<<EOD
      <li><div class="lili"><span class="white-icons blocks_images"></span>{$mc['name']}</div>
EOD;
      $ululnya = '<ul class="acitem">';
      $lilinya = "";
      foreach($mc['child'] as $k_child => $mchild){
        if(count($mchild['child']) > 0){
          $link_sub = $mchild['name'];
        }
        else{
          if(uri_string() == $mchild['link']){
            $ululnya = "<ul class='acitem' rel='open'>";
          }
          $link_sub = "<a href='".site_url($mchild['link'])."'>{$mchild['name']}</a>";
        }
        $lilinya .= <<<EOD
        <li><div class="sublili"><span class="white-icons list"></span>{$link_sub}</div>
EOD;
        if(count($mchild['child']) > 0){
          $ulnya = "<ul>";
          $linya = "";
          foreach($mchild['child'] as $kmchild => $mcchild){
            if(uri_string() == $mcchild['link']){
              $ulnya = "<ul rel='open'>";
            }
            $link_sub_child = site_url($mcchild['link']);
            $linya .= <<<EOD
              <li><div class="subsublili"><span class="white-icons book"></span><a href="{$link_sub_child}">{$mcchild['name']}</a></div>
EOD;
          }
          $lilinya .= $ulnya.$linya."</ul>";
        }
      }
      print $ululnya;
      print $lilinya;
      print <<<EOD
        </ul>
EOD;
    }
    ?>
  </ul>

<script type="text/javascript">

ddtreemenu.createTree("treemenu2", false);

</script>
  
</div>
<?=$template['body']?>
  
<!-- javascript
================================================== -->
<!-- Placed at the end of the document so the pages load faster -->
</body>
<script src="<?=$url?>js/respond.min.js"></script>
<script src="<?=$url?>js/ios-orientationchange-fix.js"></script>
<?=$foot?>
</html>